﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ISS.Models;
using ISS.Business;

namespace ISS.Controllers
{
    public class ImageController : Controller
    {
        //
        // GET: /Image/

        public ActionResult Index()
        {
            Users u = General.CheckLogin();
            if (u != null)
            {
                return View(new ImageDAO().GetLastest(u.UserId));
            }
            else
            {
                return RedirectToAction("Index", "Home");
            }
        }

        public ActionResult MyAlbum(int ID)
        {
            
            Users u = General.CheckLogin();
            if (u != null)
            {
                Session["Album"] = new AlbumDAO().GetById(ID);
                return View(new ImageDAO().GetByAlbum(ID));
            }
            else
            {
                return RedirectToAction("Index", "Home");
            }
        }
    }
}
